<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@include file="../common/head.jsp" %>
<div class="right_col" role="main">
    <form class="form-horizontal form-label-left" novalidate>
        <span class="section">库存信息</span>
        <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-5" width="15">商品id<span>*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-5">
                <input id="comId" class="form-control input-small input-sm " value="${stock.comId}" type="text"
                       readonly>
            </div>
        </div>
        <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-5">商品名称<span>*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-5">
                <input id="comName" class="form-control col-md-7 col-xs-5" value="${stock.comName}" type="text"
                       readonly>
            </div>
        </div>
        <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-5">售价 <span>*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-5">
                <input id="price" class="form-control col-md-7 col-xs-5" value="${stock.commodity.price}" type="text"
                       readonly>
            </div>
        </div>
        <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-5">进价 <span>*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-5">
                <input id="imPrice" class="form-control col-md-7 col-xs-5" value="${stock.commodity.imPrice}"
                       type="text" readonly>
            </div>
        </div>
        <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-5">生产日期<span>*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-5">
                <input id="comDate" class="form-control col-md-7 col-xs-5"
                       value="<fmt:formatDate pattern="yyyy-MM-dd" value="${stock.commodity.comDate}"/>" type="text"
                       readonly>
            </div>
        </div>
        <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-5">过期时间<span>*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-5">
                <input id="outDate" class="form-control col-md-7 col-xs-5"
                       value="<fmt:formatDate pattern="yyyy-MM-dd" value="${stock.commodity.outDate}"/>" type="text"
                       readonly>
            </div>
        </div>
        <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-5">供应商名称<span>*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-5">
                <input id="supName" class="form-control col-md-7 col-xs-5" value="${stock.commodity.supName}"
                       type="text" readonly>
            </div>
        </div>
        <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-5">商品类型<span>*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-5">
                <input id="comType" class="form-control col-md-7 col-xs-5" value="${stock.commodity.comType}"
                       type="text" readonly>
            </div>
        </div>
        <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-5">数量<span>*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-5">
                <input id="num" class="form-control col-md-7 col-xs-5" value="${stock.num}" type="text" readonly onblur="checknum()"/>
            </div>
        </div>
        <div class="item form-group">
            <label class="control-label col-md-3 col-sm-3 col-xs-5">计件方式<span>*</span>
            </label>
            <div class="col-md-6 col-sm-6 col-xs-5">
                <input id="unit" class="form-control col-md-7 col-xs-5" value="${stock.commodity.unit}" type="text"
                       readonly>
            </div>
        </div>
        <a onclick="javascript:history.back(-1);" class=" text-left btn btn-default" role="button">返回上一页</a>
        <a href="${pageContext.request.contextPath }/admin/flatform/imCommodity/toAdd"
           class="btn btn-primary text-center  col-md-offset-4 col-lg-offset-4col-xl-offset-4">商品进货</a>
        <a href="${pageContext.request.contextPath }/admin/flatform/exCommodity/toAdd"
           class="btn btn-primary text-center">商品退货</a>
        <a href="${pageContext.request.contextPath }/admin/flatform/commodity/promotion?id=${stock.comId}"
           class="btn btn-primary text-center">商品促销</a>
        <a onclick="del(${stock.id})" class="btn btn-danger text-center">删除库存</a>
    </form>
    <div class="clearfix"></div>
</div>
<%@include file="../common/footer.jsp" %>
<script type="text/javascript">
    function del(id) {
        var message = confirm("是否确认要删除?");
        if (message == true) {
            // 确认时做的操作
            window.location.href = "${pageContext.request.contextPath }/admin/flatform/stock/delete?id=" + id;
            alert("删除成功");
        }
    }
</script>